<?php $detail = $this->detail;?>
<div class='center_form'>
    <!--div class="center_form_title">Add a department</div-->
    <div class="center_form_right">
        <div class='center_form_btn_div' onclick="Agent.mysubmit()">
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/save.gif'/>
            </div>
            <div class='center_form_btn_text' ><?php echo $this->translate("saveBtn"); ?></div>
        </div>
        <div class='center_form_btn_div' onclick="Agent.deleteApply()">
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/delete.gif'/>
            </div>
            <div class='center_form_btn_text'><?php echo $this->translate("delBtn"); ?></div>
        </div>   
        <div class='center_form_btn_div' onclick='javascript:Common.gotoUrl("<?php echo HttpUtil::baseUrl();?>/customer/agent/showapply");'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/cancel.gif'/>
            </div>
            <div class='center_form_btn_text'><?php echo $this->translate("cancelBtn"); ?></div>
        </div>
    </div>
</div>
<div class="clear"></div>
<div class="centerbig_form">
    <div class="center_top"><span class="center_top_title"><?php echo $this->translate("agentInfo"); ?></span></div>
    <div class="right_form_content">

        <div class="form_content">
            <table cellspacing="0" cellpadding="0" border="0" class="order_table">
                <tr>
                    <td class="table_header" colspan="4" style="text-align:center"><?php echo $this->translate("baseInfo"); ?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("ajmmID"); ?></td>
                    <td><?php echo $detail['name'];?></td>
                    <td class="table_header"><?php echo $this->translate("fullName"); ?></td>
                    <td><?php echo $detail['full_name'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("age"); ?></td>
                    <td><?php echo $detail['age'];?></td>
                    <td class=table_header><?php echo $this->translate("sex"); ?></td>
                    <td><?php echo $detail['sex']=='1'?$this->translate("man"):$this->translate("woman");?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("compus"); ?></td>
                    <td><?php echo $detail['school'];?></td>
                    <td class="table_header"><?php echo $this->translate("department"); ?></td>
                    <td><?php echo $detail['department'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("zhuanye"); ?></td>
                    <td><?php echo $detail['zhuanye'];?></td>
                    <td class="table_header"><?php echo $this->translate("studentNo"); ?></td>
                    <td><?php echo $detail['student_id'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("region"); ?></td>
                    <td><?php echo $detail['sheng']." ".$detail['shi']." ".$detail['qu'];?></td>
                    <td class="table_header"><?php echo $this->translate("cardNo"); ?></td>
                    <td><?php echo $detail['dentity_id'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("address"); ?></td>
                    <td><?php echo $detail['address'];?></td>
                    <td class="table_header"><?php echo $this->translate("deliveryAddress"); ?></td>
                    <td><?php echo $detail['dormitory_address'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("tel"); ?></td>
                    <td><?php echo $detail['tel'];?></td>
                    <td class="table_header"><?php echo $this->translate("mobile"); ?></td>
                    <td><?php echo $detail['mobile'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("email"); ?></td>
                    <td><?php echo $detail['email'];?></td>
                    <td class="table_header">QQ</td>
                    <td><?php echo $detail['qq'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("zip"); ?></td>
                    <td><?php echo $detail['postal_code'];?></td>
                    <td class="table_header"><?php echo $this->translate("created"); ?></td>
                    <td><?php echo $detail['created'];?></td>
                </tr>
                <tr>
                    <td class="table_header" colspan="4" style="text-align:center"><?php echo $this->translate("profile"); ?></td>
                </tr>
                <tr>
                    <td colspan="4" style="text-align:center"><?php echo $detail['remarks'];?></td>
                </tr>
                <tr>
                    <td class="table_header" colspan="4" style="text-align:center"><?php echo $this->translate("remarks"); ?></td>
                </tr>
                <tr>
                    <td colspan="4" style="text-align:center"><?php echo $detail['evaluation'];?></td>
                </tr>
                <tr>
                    <td class="table_header" colspan="4" style="text-align:center"><?php echo $this->translate("currentStatus"); ?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("modified"); ?></td>
                    <td colspan="3" align="left"><?php echo  $detail['modified'];?></td>
                </tr>
                <tr>
                    <td class="table_header"><?php echo $this->translate("status"); ?></td>
                    <td colspan="3">
                        <div id="statusDiv">
                        <?php
                        if($detail['status'] == APPROVED_APPLY) {
                            echo "<input type='hidden' value='4' id='applystatus' />".$this->translate("approved");
                        }else {
                            echo "<select style = 'font-size:12px;' id = 'applystatus' onchange='Agent.changeapplystatus()'>";
                            $options = array(1=>$this->translate("newApply"),
                                2=>$this->translate("viewd"),
                                3=>$this->translate("wait"),
                                4=>$this->translate("approved"),
                                5=>$this->translate("deny"));
                            foreach ($options as $key=>$lab) {
                                if($detail['status'] == $key) {
                                    echo "<option value='$key' selected='selected'>$lab</option>";
                                }else {
                                    echo "<option value='$key'>$lab</option>";
                                }
                            }
                            echo "</select>";
                        }?>
                       </div>
                    </td>
                </tr>
                <tr id="promot" <?php echo  $detail['status']!=4?"style='display:none;'":""?>>
                    <td  colspan="4" style="text-align:center"><font color="red"><?php echo  $this->translate("prompt");?></font></td>
                </tr>
                <tr id ="username" <?php echo  $detail['status']!=4?"style='display:none;'":""?> >
                    <td class="table_header"><?php echo $this->translate("userName"); ?></td>
                    <td colspan="3" align="left"><?php echo $detail['name'];?></td>
                </tr>
                <tr id ="choosecampus" <?php echo  $detail['status']!=4?"style='display:none;'":""?> >
                    <td class="table_header"><?php echo $this->translate("chooseCampus") ?></td>
                    <td colspan="3" align="left">
                        <input id="campusesName" style="font-size:12px;float:left;" readonly onclick="Popup.showAllCampuses()" value="<?php echo $detail['area_name'] ?>" />
                        <div id="deputyErroMsg"></div>
                        <input id="campusesID" type="hidden" value="<?php echo $detail['campus_id'] ?>" />
                    </td>
                </tr>
                <tr id ="certf" <?php echo  $detail['status']!=4?"style='display:none;'":""?> >
                    <td class="table_header"><?php echo $this->translate("certf")?></td>
                    <td colspan="3" align="left">
                        <?php
                        switch($detail['certf']){
                            case '4':?>
                                <input type="radio" name="certf_level" id="ambassador"  onclick="Agent.hidedeputy('ambassador')" />校园大使
                                <input type="radio" name="certf_level" id="deputy" checked onclick="Agent.hidedeputy('deputy')"/>校园代理
                                <input type="radio" name="certf_level" id="pratiseStart" onclick="Agent.hidedeputy('pratiseStart')"/>实践之星
                    <?php      break;
                            case '1':
                            case '3':?>
                                <input type="radio" name="certf_level" id="ambassador" checked onclick="Agent.hidedeputy('ambassador')" />校园大使
                                <input type="radio" name="certf_level" id="deputy" onclick="Agent.hidedeputy('deputy')"/>校园代理
                                <input type="radio" name="certf_level" id="pratiseStart" onclick="Agent.hidedeputy('pratiseStart')"/>实践之星
                     <?php     break;
                            case '6':?>
                                <input type="radio" name="certf_level" id="ambassador" onclick="Agent.hidedeputy('ambassador')" />校园大使
                                <input type="radio" name="certf_level" id="deputy" onclick="Agent.hidedeputy('deputy')"/>校园代理
                                <input type="radio" name="certf_level" id="pratiseStart" checked onclick="Agent.hidedeputy('pratiseStart')"/>实践之星
                     <?php     break;
                        }?>
                    </td>
                </tr>
                <tr id ="highdeputy" <?php echo $detail['status']!=4|| !$detail['parent_id']?"style='display:none;'":""?> >
                    <td class="table_header"><?php echo $this->translate("highDeputy")?></td>
                    <td colspan="3" align="left">
                        <div id="deputyDiv">
                            <?php
                            $ambassadors = $this->ambassadors;
                            $selectID = "0";
                            if(!empty($ambassadors) && $ambassadors) {
                                foreach($ambassadors as $key=>$row) {
                                    if($row['id'] == $detail['parent_id'] || ($key=='0' && !$detail['parent_id'])) {
                                        $selectID = $detail['parent_id']?$detail['parent_id']:$row['id'];
                                        ?>
                            <input onclick="javascript:Popup.viewDeputy('<?php echo $row['id']?>')" type="radio" checked name="deputylist" value='<?php echo $row['name']?>' /><?php echo $row['name']?><br/>
                                    <?php    }else {?>
                            <input onclick="javascript:Popup.viewDeputy('<?php echo $row['id']?>')" type="radio" name="deputylist" value='<?php echo $row['name']?>' /><?php echo $row['name']?><br/>
                                    <?php    }
                                }
                            }else{
                                echo "<font color='red'>没有上级校园大使!</font>";
                            }?>
                            <input type='hidden' id='deputyID' value='<?php echo $selectID ?>' />
                        </div> 
                    </td>
                </tr>
            </table>
            <div id ="successDiv"></div>
        </div>
    </div>
    <div class='clear'></div>
    <!-- all school deputy start -->
    <div class="allSchool" id="allDeputy" style="display:none;">
    </div>
    <!-- all school deputy end -->
    <!-- all school info start -->
    <?php
    $province = $this->province;
    $campuses = $this->campuses;
    ?>
    <div class="allSchool" id="allSchool" style="display:none;">
        <div id="city" class="city">
            <?php
            for($i = 0; $i < count($province); $i++) {
                ?>
            <span id="title_<?php echo $i;?>" style="background-color: rgb(255, 255, 255);"><a href="javascript:Popup.showArea(<?php echo $province[$i]["id"]; ?>)"><?php echo $province[$i]["title"]; ?></a></span>
            <?php } ?>
        </div>
        <div id="area" class="area">
            <ul id="allCampuses">
                <?php
                foreach ($campuses as $name) {
                    ?>
                <li><a href="javascript:Popup.viewArea('<?php echo $name["area_name"];?>', '<?php echo $name["id"];?>');"><?php echo $name["area_name"];?></a></li>
                <?php } ?>
            </ul>

        </div>
        <div style="margin-left:400px;">
            <input name="button" type="button" value="关闭" onClick="Popup.closeBtn();" />
        </div>
    </div>
    <!-- all school info end -->
</div>
<div class='clear'></div>
<input type="hidden" id="baseurl" value="<?php echo HttpUtil::baseUrl() ?>"/>
<input type="hidden" id="applyid" value="<?php echo $detail['id'] ?>"/>
<input type="hidden" id="userid" value="<?php echo $detail['user_id'] ?>"/>
